package com.homedo.odin.solution.dao;

import com.homedo.core.common.base.dao.BaseDao;
import com.homedo.odin.solution.model.dto.SolutionListResponseBean;
import com.homedo.odin.solution.model.dto.UserSolutionCount;
import com.homedo.odin.solution.model.entity.Solution;
import java.util.Date;
import java.util.List;
import org.apache.ibatis.annotations.Param;

/**
 * <p> 方案 Mapper 接口 </p>
 *
 * @author HarveyDing
 * @since 2018-03-08
 */
public interface SolutionMapper extends BaseDao<Solution> {

    Solution getSolution(@Param("solutionId") Long solutionId);

    List<SolutionListResponseBean> querySolutionsByParams(@Param("solutionType") Integer solutionType,
            @Param("brandId") Integer brandId,
            @Param("sysAttr") Integer sysAttr, @Param("buildingType") Integer buildingType,
            @Param("status") Integer status, @Param("userId") Integer userId);

    void addSolutionPageView(@Param("solutionId") Long solutionId);

    List<SolutionListResponseBean> queryHotSolutionList(@Param("startDate") Date startDate,
            @Param("endDate") Date endDate, @Param("number") Integer number);

    List<Solution> querySolutionListForHome(@Param("number") Integer number);

    List<Solution> querySolutionForPri(@Param("solutionId") Long solutionId, @Param("solutionName") String solutionName,
            @Param("solutionType") Integer solutionType, @Param("isAdmitDownload") Integer isAdmitDownload,
            @Param("expertName") String expertName, @Param("brandId") Integer brandId, @Param("status") Integer status,
            @Param("businessCode") String businessCode, @Param("sortString") String sortString,
            @Param("isDel") Integer idDel,
            @Param("userName") String userName, @Param("formType") Integer formType);

    void updateDel(@Param("solutionId") Long solutionId, @Param("status") Integer status);

    Integer updateSort(@Param("solutionId") Long solutionId, @Param("sort") Integer sort);

    /**
     * 获取品牌商方案记录数
     */
    UserSolutionCount queryUserSolutionCount(@Param("userId") Integer userId, @Param("status") Integer status,
            @Param("solutionType") Integer solutionType);

    void handleStateChange(@Param("solutionId") Long solutionId, @Param("fromStatus") Integer fromStatus,
            @Param("toStatus") Integer toStatus, @Param("operator") String operator,
            @Param("auditOpinion") String auditOpinion);

    List<Solution> findListBySkuId(@Param("skuId") String skuId);

    List<Solution> queryMySolutionForPc(@Param("solutionType") Integer solutionType, @Param("sysAttr") Integer sysAttr,
            @Param("buildingType") Integer buildingType, @Param("shelveTimeSort") Integer shelveTimeSort,
            @Param("createTimeSort") Integer createTimeSort,
            @Param("downloadCountSort") Integer downloadCountSort, @Param("viewCountSort") Integer viewCountSort,
            @Param("commentCountSort") Integer commentCountSort, @Param("status") Integer status,
            @Param("expType") Integer expType, @Param("userId") Integer uid, @Param("brandId") Integer brandId);

    List<Solution> querySolutionForPc(@Param("solutionType") Integer solutionType, @Param("sysAttr") Integer sysAttr,
            @Param("buildingType") Integer buildingType, @Param("shelveTimeSort") Integer shelveTimeSort,
            @Param("createTimeSort") Integer createTimeSort,
            @Param("downloadCountSort") Integer downloadCountSort, @Param("viewCountSort") Integer viewCountSort, @Param
            ("commentCountSort") Integer
            commentCountSort, @Param("status") Integer status, @Param("expType") Integer expType,
            @Param("userId") Integer uid, @Param("brandId") Integer brandId);

    List<Solution> queryFreeSolution4Home(@Param("isFree") Integer isFree);

    List<Solution> queryBrandFirmSolution2(@Param("userId") Integer userId);

    List<Solution> queryBrandFirmSolution(@Param("userId") Integer uid);

    void addSolutionDownload(@Param("solutionId") Long solutionId);

    Solution findBySolutionIdAndDelAndStatus(@Param("solutionId") Long solutionId, @Param("userId") Integer userId,
            @Param("isDel") Integer isDel);

    List<Solution> findBySolutionIds(@Param("solutionIds") List<Long> solutionIds);

    List<Solution> queryUserSolutionList(@Param("userId") Integer uid, @Param("solutionName") String solutionName,
            @Param("status") Integer status,
            @Param("isAdmitDownload") Integer isAdmitDownload, @Param("isFree") Integer isFree,
            @Param("expType") Integer expType);

    void addSolutionComment(@Param("solutionId") Long solutionId);

    void updateSolutionCollect(@Param("solutionId") Long solutionId, @Param("count") Integer count);

    List<Solution> findBySolutionIdsAndNotDel(@Param("solutionIds") List<Long> solutionIds, @Param("isDel") int isDel);


    List<Solution> queryRelatedSolution(@Param("brandId")Integer brandId, @Param("firstSysTag")Integer firstSysTag,@Param("solutionId")Long solutionId,@Param("solutionType")Integer solutionType,@Param("expertId")Integer expertId);


    List<Solution> queryRelatedUserSolution(@Param("userId") Integer userId,@Param("solutionId") Long solutionId,@Param("solutionType") Integer solutionType,@Param("num") Integer num);


    List<Solution> queryRelatedFirstSystemSolution(@Param("firstSysAttr") Integer firstSysAttr,@Param("solutionId") Long solutionId,@Param("solutionType") Integer solutionType,@Param("num") Integer num);


    List<Solution> queryRelatedBuildingTypeSolution(@Param("buildingType") String buildingType,@Param("solutionId") Long solutionId,@Param("solutionType") Integer solutionType,@Param("num") Integer num);


}